class RSAOAEP_RE:
	def kg(self):
		pc_params = PC().pg()
		(pub_key, priv_key) = RSAOAEP().kg()
		return ((pub_key, pc_params), (pub_key, priv_key, pc_params))

	def enc(self, pub_key, M):
		((n,e), pc_params) = pub_key
		x = lib().ascii2int(lib().int2ascii(n) + lib().int2ascii(e))
		(com, r) = PC().com(pc_params, x)
		rM = lib().int2ascii(r) + M
		C  = RSAOAEP().enc((n,e), rM)
		return (C, com)

	def dec(self, priv_key, C, com):
		((n,e), priv, pc_params) = priv_key
		rM = RSAOAEP().dec(priv, C)
		if(rM == False):  return False
		r = lib().ascii2int(rM[:32])
		M = rM[32:]
		x = lib().ascii2int(lib().int2ascii(n) + lib().int2ascii(e))
		if(not PC().ver(pc_params, x, com, r)):  return False
		return M
